<?php
namespace app\common\model\User;

use support\Model;
use think\model\concern\SoftDelete;

class CustomerCommonModel extends Model
{
    use SoftDelete;
    protected $name = 'customer';
    protected $pk = 'id';
    protected $deleteTime = 'deletetime';

    /**
     * 状态:0=禁用,1=正常
     */
    const STATUS_OFF = 0;
    const STATUS_ON = 1;

    /**
     * 获取单个客户信息
     * @param array $option
     * @param array|string[] $field
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getCustomerInfo( array $option = [] , array $field = ['*'] )
    {
        return $this->where($option)->field($field)->find();
    }



    /**
     * 获取密码
     * @param string $password 明文密码
     * @param string $salt
     * @return string
     */
    public function createPassword(?string $password , ?string $salt = '') : string
    {
        $newPassword = md5(md5($password).$salt);
        return $newPassword;
    }


}